package structure_结构性.adapter_pattern_适配器模式;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: hihi
 * @Date: 2020/07/03/18:29
 * @Description:
 */
public class AudioPlayer implements MediaPlayer {
	@Override public void play(String mediaType, String fileName) {
		if (mediaType.equalsIgnoreCase("mp3")) {
			throw new RuntimeException("mp3格式不支持");
		}
		if (mediaType.equalsIgnoreCase("mp4") || mediaType.equalsIgnoreCase("vlc"))
			new MediaPlayAdapter(mediaType).play(mediaType, fileName);
		throw new RuntimeException("格式不支持");
	}
}
